

package com.woniu.humanresource.service.impl;

import com.woniu.humanresource.dao.CompensationSchemeDao;
import com.woniu.humanresource.entity.Blacklist;
import com.woniu.humanresource.entity.CompensationScheme;
import com.woniu.humanresource.entity.PageBean;
import com.woniu.humanresource.service.CompensationSchemeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CompensationSchemeServiceImpl implements CompensationSchemeService {
    @Resource
    CompensationSchemeDao compensationSchemeDao;

    //添加方案
    @Override
    public void insertCompensationScheme(CompensationScheme compensationScheme) {
        compensationSchemeDao.insertCompensationScheme(compensationScheme);
    }


    //条件查询方案
    @Override
    public PageBean<CompensationScheme> selectCompensationScheme(CompensationScheme compensationScheme, int pageIndex, int pageSize) {
        List<CompensationScheme> cs = compensationSchemeDao.selectupdateCompensationScheme(compensationScheme, pageIndex, pageSize);
        //        封装为PageBean对象，并设置属性
        PageBean<CompensationScheme> pageBean=new PageBean<>();
        pageBean.setBeanList(cs);
        pageBean.setPageSize(pageSize);
        pageBean.setPageIndex(pageIndex);
        pageBean.setBeginEnd();
        pageBean.setTotalRecord(selectCompensationSchemeCount(compensationScheme));
        return pageBean;
    }




    //删除方案
    @Override
    public void deleteCompensationScheme(int id) {
        compensationSchemeDao.deleteCompensationScheme(id);
    }


    //方案条数（分页）
    @Override
    public int selectCompensationSchemeCount(CompensationScheme compensationScheme) {
        int count = compensationSchemeDao.selectCompensationSchemeCount(compensationScheme);
        return count;
    }






    //修改
    @Override
    public void updateCompensationScheme(CompensationScheme compensationScheme) {
        compensationSchemeDao.updateCompensationScheme(compensationScheme);
    }


}
